@file:JvmMultifileClass
@file:JvmName("IdUtils")

package hos.kotlin

/**
 * <p>Title: IDExt </p>
 * <p>Description:  </p>
 * <p>Company: www.mapuni.com </p>
 *
 * @author : 蔡俊峰
 * @date : 2024-07-20 16:38
 * @version : 1.0
 */
fun genUuid() = java.util.UUID.randomUUID().toString()

fun genUUID() = java.util.UUID.randomUUID().toString().uppercase()

fun genID() = java.util.UUID.randomUUID().toString().uppercase().replace("-".toRegex(), "")

fun genDatetime(): String {
    var time = System.currentTimeMillis().time(TimeFormat.full_s)
    if (time.contains("-")) {
        time = time.replace("-".toRegex(), "")
    }
    if (time.contains(" ")) {
        time = time.replace(" ".toRegex(), "")
    }
    if (time.contains(".")) {
        time = time.replace("\\.".toRegex(), "")
    }
    return time
}